﻿using System;

namespace SpatialHashLib.Topology.Indexing
{
    struct Cell
    {
        static Cell empty;

        static Cell()
        {
            empty = new Cell();
            empty.chainIndex = -1;
            empty.itemCount = 0;
            empty.childCount = 0;
        }

        public static Cell Empty
        {
            get { return empty; }
        }

        int chainIndex;
        int itemCount;
        int childCount;

        public Cell(int chainIndex)
        {
            this.chainIndex = chainIndex;
            this.itemCount = 0;
            this.childCount = 0;
        }

        public int ChainIndex
        {
            get { return chainIndex; }
            set { chainIndex = value; }
        }

        public int ItemCount
        {
            get { return itemCount; }
            set { itemCount = value; }
        }

        public int ChildCount
        {
            get { return childCount; }
            set { childCount = value; }
        }

        public bool IsEmpty
        {
            get { return chainIndex == -1; }
        }

        public override string ToString()
        {
            return "(ChainIndex, ItemCount, ChildCount: " + chainIndex + ", " + itemCount + ", " + childCount + ")";
        }
    }
}
